require.config({ //第一块，配置
	baseUrl: '',
	shim: {
		jquery: {
			exports: 'jquery'
		},
		Router: {
			exports: 'Router'
		},
		swipe: {
			exports: 'swipe'
		},
		APPdate: {
			exports: 'APPdate'
		},
		scroll: {
			exports: 'scroll'
		},
		echarts: {
			deps: ['jquery'],
			exports: 'echarts'
		},
		slider: {
			deps: ['jquery'],
			exports: 'slider'
		},
		common: {
			exports: 'common'
		}
		// ,
		// cordova: {
			// exports: 'cordova'
		// }
	},
	paths: {
		avalon: ["plugin/avalon/avalon"], //必须修改源码，禁用自带加载器，或直接删提AMD加载器模块
		text: ['plugin/require/text'],
		css: ['plugin/require/css'],
		domReady: 'plugin/require/domReady',
		Router: 'plugin/custom/router',
		jquery: 'plugin/jquery/jquery-1.7.2.min',
		swipe: 'plugin/custom/swiper-3.4.0.min',
		APPdate: 'plugin/custom/APPDateField.min',
		scroll: 'plugin/custom/scroll',
		echarts: 'plugin/custom/echarts-all',
		slider: 'plugin/custom/jquery.slider.min',
		common: 'plugin/custom/common',
		// cordova:'cordova'
	},
	//加版本号
	  priority: ['text'],
	  urlArgs: "bust=" +  (new Date()).getTime()
});

require(["avalon", "domReady!", "jquery", "Router", 'common'], function(avalon, domReady, jquery, Router, common) {
	var model = avalon.define('root', function(vm) {
		vm.content="";
	});
	//导航回调
	function callback() {
		var jspath = "modules"; //这里改成您自己的网站地址 ,这个是js路径的变量
		var pagepath = ""; //这个是网页的变量
		var paths = location.hash.split("/");
		for(var i = 0; i < paths.length; i++) {
			if(paths[i] != "#") {
				jspath += "/" + paths[i];
			}
		}
		window.init_page = jspath.split('/')[1];
		require([jspath], function(page) {
			pagepath = avalon.templateCache[window.init_page];
			avalon.vmodels.root.content = pagepath;
			if(avalon.vmodels[window.init_page] && avalon.vmodels[window.init_page].init)
				avalon.vmodels[window.init_page].init();
		});

	}
	try{
		window.setTimeout(init, 1000);
	}catch(e){
		alert(e)
	}
	
	Router.route("/addFamily/addFamily", callback); //添加家人或添加自己
	Router.route("/addInfo/addInfo", callback); //添加家人手机号
	Router.route("/detailInfo/detailInfo", callback); //添加家人详细信息
	Router.route("/detailSelf/detailSelf", callback); //添加自己详细信息
	Router.route("/device/device", callback); //设备扫描
	Router.route("/Home/Home", callback); //首页
	Router.route("/info/info", callback); //个人资料
	Router.route("/selfInfo/selfInfo", callback); //添加自己手机号
	Router.route("/relation/relation", callback); //添加紧急联系人手机号
	Router.route("/setup/setup", callback); //设置
	Router.route("/feedBack/feedBack", callback); //意见反馈 
	Router.route("/pattern/pattern", callback); //设备管理 
	Router.route("/aboutus/aboutus", callback); //关于我们 
	Router.route("/result/result", callback); //扫一扫结果 
	Router.route("/basic/basic", callback); //个人中心 
	Router.route("/message/message", callback); //消息中心 
	Router.route("/target/target", callback); //近期目标 
	Router.route("/targeting/targeting", callback); //近期目标2 
	Router.route("/blood/blood", callback); //血糖近期目标1 
	Router.route("/blooding/blooding", callback); //血糖近期目标2
	Router.route("/hobby/hobby", callback); //不良生活习惯 
	Router.route("/allergic/allergic", callback); //过敏史 
	Router.route("/detail/detail", callback);//消息详情 
	Router.route("/start/start", callback);
	Router.default("/Home/Home");
	avalon.scan();
});